The reduce() function is used to reduce an array to a single value by applying a given function to each element in the array.
reduce()
The function takes an accumulator and the current value as arguments and returns the updated accumulator.